<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/1/4
 * Time: 14:58
 */

namespace App\Http\Controllers\MiniProgram;


use App\Http\Logics\MiniProgram\PartyPhotoLogic;
use App\Http\Traits\PartyPhotoTrait;
use App\Http\Controllers\BaseController;
class PartyPhotoController extends BaseController
{
    use PartyPhotoTrait;

    /**
     * @SWG\Post(
     *     path="/partyPhoto/update",
     *     tags={"PartyPhoto"},
     *     description="更新活动图片",
     *     operationId="getPartyDetail",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="party_id",
     *         in="query",
     *         description="活动ID",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="photo_list_str",
     *         in="query",
     *         description="活动图片列表字符串",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function updatePartyPhoto()
    {
        $party_id = $this->party_id;
        $photo_list_str = $this->photo_list_str;
        $data = [
            'party_id' => $party_id,
            'photo_list_str' => $photo_list_str
        ];
        $response = PartyPhotoLogic::handlePartyPhotoArray($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->code, $response->data);
    }

    /**
     * @SWG\Post(
     *     path="/partyPhoto/list",
     *     tags={"PartyPhoto"},
     *     description="获取活动图片列表",
     *     operationId="getPartyPhotoList",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="party_id",
     *         in="query",
     *         description="活动ID",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getPartyPhotoList()
    {
        $party_id = $this->party_id;
        $data = [
            'party_id' => $party_id
        ];

        $response = PartyPhotoLogic::getPartyPhotoList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }
}